VERSION 5.00
Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "MSDATLST.OCX"
Begin VB.Form frmAgregarProductoAlPerfil 
   BackColor       =   &H80000013&
   BorderStyle     =   5  'Sizable ToolWindow
   Caption         =   "Form1"
   ClientHeight    =   1770
   ClientLeft      =   45
   ClientTop       =   315
   ClientWidth     =   4365
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   Moveable        =   0   'False
   ScaleHeight     =   1770
   ScaleWidth      =   4365
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  'CenterScreen
   Begin VB.CommandButton CmdSalir 
      BackColor       =   &H00E0E0E0&
      Caption         =   "&Salir"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   6.75
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   615
      Left            =   3120
      Picture         =   "frmAgregarProductoAlPerfil.frx":0000
      Style           =   1  'Graphical
      TabIndex        =   3
      Top             =   960
      Width           =   735
   End
   Begin VB.CommandButton CmdAgregar 
      BackColor       =   &H00E0E0E0&
      Caption         =   "&Agregar"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   6.75
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   615
      Left            =   2280
      MaskColor       =   &H00E0E0E0&
      Picture         =   "frmAgregarProductoAlPerfil.frx":058A
      Style           =   1  'Graphical
      TabIndex        =   2
      Top             =   960
      Width           =   735
   End
   Begin MSDataListLib.DataCombo cboAgregarProducto 
      Bindings        =   "frmAgregarProductoAlPerfil.frx":0B14
      Height          =   285
      Left            =   240
      TabIndex        =   1
      Top             =   480
      Width           =   3735
      _ExtentX        =   6588
      _ExtentY        =   556
      _Version        =   393216
      Appearance      =   0
      BackColor       =   12648447
      ListField       =   "nombre_producto"
      BoundColumn     =   "codigo_producto"
      Text            =   ""
      Object.DataMember      =   "invCProductos"
   End
   Begin VB.Label Label1 
      BackStyle       =   0  'Transparent
      Caption         =   "Producto a Agregar para todos los Perfiles"
      ForeColor       =   &H00C00000&
      Height          =   255
      Left            =   240
      TabIndex        =   0
      Top             =   240
      Width           =   3135
   End
End
Attribute VB_Name = "frmAgregarProductoAlPerfil"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub CmdAgregar_Click()
    
    On Error GoTo chaz
    If DE.rsLosPerfiles.State = adStateOpen Then DE.rsLosPerfiles.Close
    DE.LosPerfiles
    
    
    ' verificar de que empresa es el producto seleccionado
       Dim rsEmoresa As ADODB.Recordset
       Set rsEmoresa = New ADODB.Recordset
       rsEmoresa.Open "select Codigo_Empresa from sacf_inventarios..invproductos where codigo_producto = '" & cboAgregarProducto.BoundText & "'", DE.Cnn, adOpenDynamic, adLockReadOnly
       Empresa = rsEmoresa.Fields("Codigo_Empresa").Value
    
    With DE.rsLosPerfiles
        For i = 1 To DE.rsLosPerfiles.RecordCount
            Codigo_Perfil = .Fields("Codigo_Perfil")
            Codigo_Tipo_EmpleadoComision = .Fields("Codigo_Tipo_EmpleadoComision")
            Coidgo_Tipo_EmpleadoOrigen = .Fields("Coidgo_Tipo_EmpleadoOrigen")
            Unidad_Diferente = .Fields("Unidad_Diferente")
        
                 DE.PlaMPorcComiEmpProd "I", Codigo_Perfil, Codigo_Tipo_EmpleadoComision, Coidgo_Tipo_EmpleadoOrigen, _
                 Unidad_Diferente, cboAgregarProducto.BoundText, 0, 0, 0, 15, 0, 0, 80, Empresa
        
             DE.rsLosPerfiles.MoveNext
        Next
    End With
    MsgBox "Operacion Satisfactoria.."
    Unload Me
    Exit Sub


chaz:
    MsgBox "Este Producto ya existe dentro de los perfiles "
    

End Sub

Private Sub cmdSalir_Click()
        Unload Me
End Sub

Private Sub Form_Load()
    Left = Screen.Width / 2 - Width / 2
    Top = (Screen.Height / 2 - Height / 2) - 800
    Me.Picture = LoadResPicture(103, 0)
    
End Sub
